package com.lib.common.views;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.lib.commom.R;

/**
 * @Author rames
 * @date 2019/3/12 16:54
 */
public class LoadingDialog extends Dialog {
    private String content;

    public LoadingDialog(@NonNull Context context) {
        super(context);
        init();
    }

    public LoadingDialog(@NonNull Context context, String content) {
        super(context);
        this.content = content;
        init();
    }

    private void init(){
        setContentView(R.layout.dialog_loading);
        setCanceledOnTouchOutside(false);
        TextView contentTV = findViewById(R.id.content_tv);
        contentTV.setVisibility(View.GONE);
        contentTV.setText(TextUtils.isEmpty(content) ? "Loading..." : content);
    }
}
